package erfgame.frontend.desktop.view.terrain.iso.interaction;

import java.util.ArrayList;
import java.util.List;

import erfgame.core.Point3D;
import erfgame.core.entity.Entity;

@SuppressWarnings(value="unchecked")
public class CompositeEntityInteractionDescriptionFactory implements
		EntityInteractionDescriptionFactory {

	private List<EntityInteractionDescriptionFactory> interactionDescriptionFactories;
	
	public CompositeEntityInteractionDescriptionFactory(List<EntityInteractionDescriptionFactory> interactionDescriptoinFactories) {
		this.interactionDescriptionFactories = interactionDescriptoinFactories;
	}
	
	public List<InteractionDescription> getInteractions(Entity e, Point3D terrainPosition) {
		ArrayList<InteractionDescription> result = new ArrayList<InteractionDescription>();
		for( int i=0; i<interactionDescriptionFactories.size(); i++ ) {
			EntityInteractionDescriptionFactory factory;
			factory = interactionDescriptionFactories.get( i );
			result.addAll( factory.getInteractions(e, terrainPosition));
		}
		return result;
	}
}
